package com.cosina.game.fly;

import java.nio.FloatBuffer;
import java.util.Random;

public class Block {
	
	float x,y,z;
	float[] rgba = getRandomRgba();
	
	public Block(int x, int z){
		this.x = x;
		this.y = - 1f;
		this.z = z;
	}
	
	public void moveOut(){
		this.z ++;
	}
	
	public boolean dead(){
		return this.z >= 0;
	}
	
	static float one = 0.5f;
	public static FloatBuffer vertextsBuffer = FloatBuffer.wrap(new float[]{
			-one,-one,one,
			one,-one,one,
			-one,one,one,
			one,one,one,
			
			-one,-one,-one,
			one,-one,-one,
			-one,one,-one,
			one,one,-one,
			
			//left
			-one,one,one,
			-one,one,-one,
			-one,-one,-one,
			-one,-one,one,
			
			//right
			one,one,one,
			one,one,-one,
			one,-one,one,
			one,-one,-one,
			
			//top
			-one,one,one,
			one,one,one,
			-one,one,-one,
			one,one,-one,
			
			//bottom
			-one,-one,one,
			one,-one,one,
			-one,-one,-one,
			one,-one,-one,
	});
	
	private static Random  colorRandom = new Random();
	
	public static float[] getRandomRgba(){
		return colors[colorRandom.nextInt(colors.length)];
	}
	
	private static float[][] colors = new float[][]{
		{1f,0f,0f,1f},
		{0f,1f,0f,1f},
		{0f,0f,1f,1f},
		{1f,1f,0f,1f},
		{0f,1f,1f,1f},
		{1f,0f,1f,1f},
	};
}
